package com.bitbakery.plugin.lisp.lang.psi;

import com.bitbakery.plugin.lisp.lang.LispElementVisitor;
import com.bitbakery.plugin.lisp.lang.LispFileType;
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope;
import org.jetbrains.annotations.NotNull;

public class CLElement extends ASTWrapperPsiElement {
    public CLElement(@NotNull final ASTNode node) {
        super(node);
    }

    @NotNull
    public Language getLanguage() {
        return LispFileType.LISP;
    }

    public void accept(@NotNull PsiElementVisitor visitor) {
        if (visitor instanceof LispElementVisitor) {
            ((LispElementVisitor) visitor).visitCommonLispElement(this);
        } else {
            super.accept(visitor);
        }
    }

    @NotNull
    public SearchScope getUseScope() {
        //This is true as long as we have no inter-file references
        return new LocalSearchScope(getContainingFile());
    }
}
